export default {
    data() {
        return {

        }
    },
    computed: {
        // 是否显示详情
        showDetail() {
            if (this.showType != 2) {
                return true
            } else {
                return false
            }
        }
    },
    methods: {
        /// 单张上传图片成功
        handleSingleImgUpload(val, urlName, idName) {
            this.editPara[urlName] = val
            this.editPara[idName] = val.fileId || ""
        },
        // 上传多张图片成功
        handleMulUpload(val, urlName, idName) {
          this.editPara[urlName] = val
          this.editPara[idName] = val? val.map(item => item.fileId) : []
        },
        // 多图时删除图片
        handleDelImg(val, urlName, idName) {
          this.editPara[urlName].splice(val, 1);
        },
        // 地图
        handleChangeAddr(addr) {
          this.editPara.longitude = addr.lng;
          this.editPara.dimensionality = addr.lat;
          this.editPara.latitude = addr.lat;
          this.editPara.address = addr.address;
        },
        // 校验
        handleBlur(type, name){
            // 手机号校验
            if (type == 'phone') {
                if (!(/^1\d{10}$/g).test(this.editPara[name])) {
                    this.$message.error('请输入正确手机号格式')
                    this.editPara[name] = ''
                    return
                }   
            }
        }
    }
}